package com.example.project_01.controller;

import com.example.project_01.commons.ApiResponse;
import com.example.project_01.dto.account.AccountDTO;
import com.example.project_01.dto.account.LoginResponseDTO;
import com.example.project_01.service.AccountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: AccountController
 * Package: com.example.project_01.controller
 * Description:
 *
 * @Author ShiYi
 * @Create 2025/10/13 11:39
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
@Tag(name = "用户控制器类",description = "账户的操作")
@CrossOrigin // 跨域
public class AccountController {
    @Autowired
    AccountService accountService;

    @PostMapping("/login")
    @Operation(summary = "用户登录",description = "传入一个AccountDTO对象（json类型）")
    public ApiResponse<LoginResponseDTO> login(@RequestBody AccountDTO accountDTO){
        return accountService.loginService(accountDTO);
    }
}
